import appconfig from '../config/appconfig.js';
export default function (){
    return async function (ctx,next){
        //允许所有跨域请求
        ctx.set('Assess-Control-Allow-Origin',appconfig.cors);
        ctx.set('Access-Control-Allow-Methods','GET,POST,PUT,DELETE,OPTIONS');
        //指定允许请求头
        ctx.set('Access-Control-Headers','Content-Type');
        //预检请求返回200状态码
        ctx.status=200;
        await next();
    }
}